package com.suneast.suneaststore.modules.personal.wallet;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.suneast.suneaststore.R;
import com.suneast.suneaststore.ui.fragments.BaseFragment;

import butterknife.BindView;
import butterknife.OnClick;

public class CoinFragment extends BaseFragment {
    @Override
    public int setLayout() {
        return R.layout.fragment_coin;
    }

    private String coinValue = "0.00";

    public CoinFragment withCoinValue(String value) {
        coinValue = value;
        return this;
    }

    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.tv_coin_balance_value)
    TextView coinValueTv;

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, @NonNull View rootView) {
        initView();
    }

    private void initView() {
        toolbar.setNavigationOnClickListener(v -> pop());
        coinValueTv.setText(coinValue);
    }

    @OnClick({R.id.img_top_up, R.id.tv_top_up, R.id.img_go_top_up,
            R.id.img_withdraw_deposit, R.id.tv_donate, R.id.img_go_donate})
    public void onViewClick(View view) {
        switch (view.getId()) {
            case R.id.img_top_up:
            case R.id.tv_top_up:
            case R.id.img_go_top_up: {
                start(new CoinTopUpFragment().withCoinValue(coinValue));
            }
            break;
            case R.id.img_withdraw_deposit:
            case R.id.tv_donate:
            case R.id.img_go_donate: {
            }
            break;
        }
    }
}
